module oderogue.tcod.Key;

import derelict.tcod.libtcod;

public alias TCOD_keycode_t KeyCode;

public struct Key
{
	private TCOD_key_t key;
	
	public alias key this;
	
	public this(TCOD_key_t key)
	{
		this.key = key;
	}
	
	@property
	{
		/**
		 * An arbitrary value representing the physical key on the keyboard. Possible values are stored in 
		 * the TCOD_keycode_t enum. If no key was pressed, the value is TCODK_NONE.
		 */
		public KeyCode keycode() { return key.vk; } ;
		
		/**
		 * If the key correspond to a printable character, the character is stored in this field. Else, this field 
		 * contains 0.
		 */
		public char character() { return key.c; };
			
		/**
		 * True if the event is a key pressed, or false for a key released.
		 */
		public bool pressed() { return key.pressed; }
		
		/**
		 * This field represents the status of the left Alt key : true => pressed, false => released.
		 */		
		public bool lalt() { return key.lalt; }
			
		/**
		 * This field represents the status of the right Alt key : true => pressed, false => released.
		 */		
		public bool ralt() { return key.ralt; }
			
		/**
		 * This field represents the status of the left Control key : true => pressed, false => released.
		 */		
		public bool lctrl() { return key.lctrl; }
				
		/**
		 * This field represents the status of the right Control key : true => pressed, false => released.
		 */		
		public bool rctrl() { return key.rctrl; }
				
		/**
		 * This field represents the status of the shift key : true => pressed, false => released.
		 */		
		public bool shift() { return key.shift; }
	}
}